﻿using System;
using System.Collections.Generic;
using System.Text;

namespace RaisingStudio.Data.Entities
{
    partial class Issue : RaisingStudio.Data.Common.IDataObjectProxy
    {
        #region IDataObjectProxy Members

        public Type GetPropertyType(string name)
        {
            switch (name)
            {                
                case "IssueID":
                   {
                       return typeof(int);
                   }
                case "Title":
                   {
                       return typeof(string);
                   }
                case "Description":
                   {
                       return typeof(string);
                   }
                case "Status":
                   {
                       return typeof(IssueStatus);
                   }
                case "IssueType":
                   {
                       return typeof(IssueType?);
                   }
                case "Owner":
                   {
                       return typeof(string);
                   }
                case "Progress":
                   {
                       return typeof(decimal?);
                   }
                case "CreateTime":
                   {
                       return typeof(DateTime);
                   }
                case "Locked":
                   {
                       return typeof(bool?);
                   }
                default:
                    {
                        throw new System.ArgumentOutOfRangeException(name);
                    }
            }
        }

        #endregion

        #region IObjectAccessor Members

        public object GetValue(object instance, string name)
        {
            Issue _instance = instance as Issue;
            switch (name)
            {                
                case "IssueID":
                   {
                       return _instance.IssueID;
                   }
                case "Title":
                   {
                       return _instance.Title;
                   }
                case "Description":
                   {
                       return _instance.Description;
                   }
                case "Status":
                   {
                       return _instance.Status;
                   }
                case "IssueType":
                   {
                       return _instance.IssueType;
                   }
                case "Owner":
                   {
                       return _instance.Owner;
                   }
                case "Progress":
                   {
                       return _instance.Progress;
                   }
                case "CreateTime":
                   {
                       return _instance.CreateTime;
                   }
                case "Locked":
                   {
                       return _instance.Locked;
                   }
                default:
                    {
                        throw new System.ArgumentOutOfRangeException(name);
                    }
            }
        }

        public void SetValue(object instance, string name, object value)
        {
            Issue _instance = instance as Issue;
            switch (name)
            {                
                case "IssueID":
                    {
                        _instance.IssueID = (int)value;
                        return;
                    }
                case "Title":
                    {
                        _instance.Title = (string)value;
                        return;
                    }
                case "Description":
                    {
                        _instance.Description = (string)value;
                        return;
                    }
                case "Status":
                    {
                        _instance.Status = (IssueStatus)value;
                        return;
                    }
                case "IssueType":
                    {
                        _instance.IssueType = (IssueType?)value;
                        return;
                    }
                case "Owner":
                    {
                        _instance.Owner = (string)value;
                        return;
                    }
                case "Progress":
                    {
                        _instance.Progress = (decimal?)value;
                        return;
                    }
                case "CreateTime":
                    {
                        _instance.CreateTime = (DateTime)value;
                        return;
                    }
                case "Locked":
                    {
                        _instance.Locked = (bool?)value;
                        return;
                    }
                default:
                    {
                        throw new System.ArgumentOutOfRangeException(name);
                    }
            }
        }

        #endregion

        #region IObjectCreater Members

        public object CreateObject()
        {
            return new Issue();
        }

        public System.Collections.IList CreateObjectList()
        {
            return new System.Collections.Generic.List<Issue>();
        }

        #endregion
    }
}
